package com.zhong.bmob.server;

import com.zhong.bmob.inter.ILoginUserDown;
import com.zhong.bmob.model.User;

import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;

/**
 * Created by 俊峰 on 2017/5/15.
 * 用于调用Bmob的登录功能
 */

public class Login {
    public static void userLogin(User user, final ILoginUserDown mUserDown){
        user.login(new SaveListener<User>() {
            @Override
            public void done(User user, BmobException e) {
                if (e == null){
                    mUserDown.loginSuccess(user);
                } else {
                    mUserDown.loginFail(e);
                }
            }
        });
    }
}
